package com.bmt.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author mickyfeng on 14-1-10.
 */
public class System_Utils {
    // -----------SYSTEM LANGUANG----------------//系统语言
    public static final String LANGUAGE_ZH = "cn";
    public static final String LANGUAGE_HK = "hk";
    public static final String LANGUAGE_EN = "en";
    // -----------SYSTEM names----------------//系统名称
    public static final String SYS_NAME_POS="pos";
    // -----------SYSTEM setting----------------//系统设置
    public static final String SYS_LOCALE = "locale";
    public static final String SYS_LOCALE_AREA = "_sys_locale_area_";
    public static final String CONFIG_FILENAME = "POSConfig.config";
    
    public static final String FEMALE = "0";// 女性
    public static final String MALE = "1";// 男性
    // -----------operate,send email------------//Email发送类型
    public static final String DEVELOPER_MAIL = "fengmicky@gmail.com";
    public static final String SEND_MAIL = DEVELOPER_MAIL;
//    public static final String SEND_SMTP_HOST = "192.168.1.102";
//    public static final String SEND_USER_NAME = "admin";
//    public static final String SEND_USER_PW = "3x412200x0";

    // -----------店铺/仓库/办公室类型------------//
    public static final String OFFICE = "O";// 办公室
    public static final String STORE = "S";// 店铺
    public static final String WAREHOUSE = "W";// 仓库

    // -----------操作状态------------//
    // public static final String OS_NEW="N";//新增状态.
    // public static final String OS_SAVE="S";//保存状态.
    public static final String OS_EDIT = "E";// 编辑状态.
    public static final String OS_NO = "N";// 无状态;

    public static final String INTERNAL_SITE = "127.0.0.1";
    public static final String INTERNET_SITE = "127.0.0.1";

    public static final String LOGIN_USER = "loginUser";
    
    //------------每页记录数-----------//
    public static final int PAGE_SIZE = 15;

    public synchronized static String getUniquelyID() {
        SimpleDateFormat UniquelyFormat = new SimpleDateFormat("yyyyMMddHHmmssSSSS");
        return UniquelyFormat.format(new Date());
    }

    private static Boolean test = null;

    /**
     * 测试状态;如果不是20.202和20.201服务器.其它机都为测试机.
     * @return
     */
    public static Boolean isTest() {
        if (test != null)
            return test;
        test = true;
        try {
            String ip = InetAddress.getLocalHost().getHostAddress();
            if (ip != null && (ip.equals(INTERNAL_SITE) || ip.equals(INTERNET_SITE))) {
                test = false;
            }
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        return test;
    }



}
